package sentity

import (
	"path/filepath"
	"server/application/db/schema/dbops"
	"time"
)

// 用户配置
type AccountConfig struct {
	ID          uint      `gorm:"primaryKey;autoIncrement" `
	AccountId   uint      `gorm:"not null" json:"account_id"` //0表示系统配置
	ConfigKey   string    `gorm:"not null" json:"config_key"` //json 格式数据
	ConfigValue string    `gorm:"not null" json:"config_value"`
	CreatedAt   time.Time `gorm:"" json:"created_at"`
	UpdatedAt   time.Time `gorm:"" json:"updated_at"`
}

// GenConfig 生成相关配置
func (u AccountConfig) GenConfig() dbops.EntityConfig {
	return dbops.EntityConfig{
		Title:             "用户自定义配置",
		AsName:            "",                       //实体别名，请使用大驼峰命名法
		ViewsFatherFolder: filepath.Join("account"), //视图父目录
	}
}
func (AccountConfig) TableName() string {
	return "account_configs"
}
